import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        headerBgState: null, //header  的背景图片 动态变化的
        DetailArticle:"<p><span style=\"font-size: medium; font-weight: normal;\">请输入内容</span></p>",  //文章的详情
        ArticleId:null,  //当前选择文章的 id

    },
    mutations: {
        ['HEADER_BG_STATE'](state, name) {
            state.headerBgState = name
        }
        ,
        ['DETAIL_ARTICLE'](state, name) {
            state.DetailArticle = name
        },
        ['ARTICLE_ID'](state, name) {
            state.ArticleId = name
        }
    },
    actions: {
        changeHeaderBgState: function ({commit}, name) {
            commit('HEADER_BG_STATE', name);
        }
        ,
        changeDetailArticle: function ({commit}, name) {
            commit('DETAIL_ARTICLE', name);
        }  ,
        changeArticleId: function ({commit}, name) {
            commit('ARTICLE_ID', name);
        }

    }
})
